<?php
  	class Mindex extends CI_Model{
		protected $_table = "tbl_intro";
		protected $_cate = "tbl_category";
		protected $_cago = "tbl_categorie";
		protected $_sup ="tbl_support";
		protected $_menu ="tbl_menu";
		protected $_intro ="tbl_intro";		
		protected $_education ="tbl_education";
		protected $_contact ="tbl_contact_info";
		protected $_con ="tbl_contact";						
		protected $_post ="tbl_posts";						
		protected $_config ="tbl_config";
		protected $_service ="tbl_services";
		protected $_subject ="tbl_subjects";						
		public function __construct(){
			parent::__construct();
			$this->load->database();
		}
		public function config(){
			$this->db->where("config_id","1");
			return $this->db->get($this->_config)->row_array();
		}
		public function listsubject(){
			$this->db->order_by("subject_order","ASC");
			return $this->db->get($this->_subject)->result_array();
		}
		public function educations(){
			$this->db->where("education_status",1);
			$this->db->order_by("education_order","ASC");
			return $this->db->get($this->_education)->result_array();
		}
		public function get_post($cate_id){
			$this->db->where("cate_id",$cate_id);
			$this->db->order_by("post_id","ASE");
			$this->db->limit(5);
			return $this->db->get($this->_post)->result_array();
		}
		public function support($limit=3){
			$this->db->limit($limit);
			return $this->db->get($this->_sup)->result_array();
		}
		public function contact(){
			$this->db->where("contact_id","1");
			return $this->db->get($this->_contact)->row_array();
		}
		public function intro($id){
			$this->db->where("in_rewrite",$id);
			return $this->db->get($this->_table)->row_array();
		}
		public function services(){
			$this->db->where("service_id","1");
			return $this->db->get($this->_service)->row_array();
		}
		public function insert_con($data){
			$this->db->insert($this->_con,$data);
		}
		public function listintro($off="",$start=""){
			$this->db->order_by("in_order","ASC");
			$this->db->order_by("in_status",1);
			return $this->db->get($this->_table)->result_array();
		}
		public function listcustomer(){
			$query = $this->db->query("select * from tbl_customer order by RAND() limit 30");
			return $query->result_array();
		}
		public function customer_asc(){
			$query = $this->db->query("select * from tbl_customer order by RAND() limit 30");
			return $query->result_array();
		}
	}